const router = require('koa-router')()
const goodsSkuList = require('../api/myGoodsSkuList')
router.prefix('/goodsSkuList')
// #region
/**
 * @swagger
 * /goodsSkuList/getList 获取该商品的所有规格列表（根据商品id查询）:
 *   get:
 *     description: 获取该商品的所有规格列表（根据商品id查询）
 *     tags: [商品规格列表模块]
 *     produces:
 *       - application/json
 *     parameters:
 *       - name: goodsId
 *         description: 传商品id查询单个商品下的列表，传空值则查询全部
 *         in: formData
 *         required: true
 *         type: number
 *     responses:
 *       0:
 *         description: 成功
 *         schema:
 *           type: object
 *           $ref: '#/definitions/success'
 *       -1:
 *         description: 失败
 *         schema:
 *           type: object
 *           $ref: '#/definitions/fail'
 */
// #endregion
router.get('/getList', goodsSkuList.getList)
// #region
/**
 * @swagger
 * /goodsSkuList/modifyList 新增或修改商品规格（传了id视为修改）（这里增加规格后端已做已有相同规格判断）:
 *   post:
 *     description: 新增或修改商品规格（传了id视为修改）（这里增加规格后端已做已有相同规格判断）
 *     tags: [商品规格列表模块]
 *     produces:
 *       - application/json
 *     parameters:
 *       - name: id
 *         description: 规格列表id（传了为修改，未传为增加）
 *         in: formData
 *         required: true
 *         type: number
 *       - name: parentId
 *         description: 商品id
 *         in: formData
 *         required: true
 *         type: number
 *       - name: price
 *         description: 价格
 *         in: formData
 *         required: true
 *         type: number
 *       - name: stock_num
 *         description: 该规格的库存
 *         in: formData
 *         required: true
 *         type: number
 *       - name: s1
 *         description: 规格大类标识和小类id（前端动态增加删除字段）
 *         in: formData
 *         required: true
 *         type: number
 *       - name: s2
 *         description: 规格大类标识和小类id（前端动态增加删除字段）
 *         in: formData
 *         required: true
 *         type: number
 *     responses:
 *       0:
 *         description: 成功
 *         schema:
 *           type: object
 *           $ref: '#/definitions/success'
 *       -1:
 *         description: 失败
 *         schema:
 *           type: object
 *           $ref: '#/definitions/fail'
 */
// #endregion
router.post('/modifyList', goodsSkuList.modifyList)
// #region
/**
 * @swagger
 * /goodsSkuList/deleteList 删除规格列表（可传单个或多个，字符串“,”拼接）:
 *   delete:
 *     description: 删除规格列表（可传单个或多个，字符串“,”拼接）
 *     tags: [商品规格列表模块]
 *     produces:
 *       - application/json
 *     parameters:
 *       - name: ids
 *         description: 可传单个或多个，字符串“,”拼接
 *         in: formData
 *         required: true
 *         type: string
 *     responses:
 *       0:
 *         description: 成功
 *         schema:
 *           type: object
 *           $ref: '#/definitions/success'
 *       -1:
 *         description: 失败
 *         schema:
 *           type: object
 *           $ref: '#/definitions/fail'
 */
// #endregion
router.delete('/deleteList', goodsSkuList.deleteList)
module.exports = router